/**
 * \file UnitSelector.h
 * \brief Header file for \a UnitSelector class.
 * \ingroup Gui
 */

#ifndef UNITSELECTOR_H
#define UNITSELECTOR_H

#include<QDialog>
#include<QDialogButtonBox>
#include<QHBoxLayout>
#include<QLabel>
#include<QList>
#include<QPushButton>
#include<QVBoxLayout>
#include<QWidget>

class Map;
class Unit;
class UnitSelectionWidget;

/**
 * \class UnitSelector
 * \brief A dialog class that will allow us to choose the composition of the two simulated teams.
 * \ingroup Gui
 */

class UnitSelector: public QDialog{
Q_OBJECT
public:
	static bool getTeams( QList<Unit*> &teamA, QList<Unit*> &teamB, Map *map );///<Static function to combine the entire functionality of this dialog.
	~UnitSelector();///<Destructor.
private slots:
	void slotAccepted();///<Called when user clicks OK.
	void slotRejected();///<Called when user clicks Cancel.
	void slotTeamAMore();///<Called to add a \a Unit to team A.
	void slotTeamBMore();///<Called to add a \a Unit to team B.
	void slotTeamADelete();///<Called to delete a \a Unit from team A.
	void slotTeamBDelete();///<Called to delete a \a Unit from team B.
private:
	UnitSelector(QList<Unit*> &teamA, QList<Unit*> &teamB, Map *map);///<Constructor. \param teamA A reference to team A's units. \param teamB A reference to team B's units. \param map A \a Map pointer for unit construction.
	Map *m_map;///<\a Map pointer for unit construction.
	QList<Unit*> &m_teamA;///<A reference to team A's units.
	QList<Unit*> &m_teamB;///<A reference to team B's units.
	
	QVBoxLayout *m_layout;///<Gui stuff.
	QDialogButtonBox *m_buttons;///<Gui stuff.
	QLabel *m_label;///<Gui stuff.
	QWidget *m_teamsWidget;///<Gui stuff.
	QHBoxLayout *m_teamsLayout;///<Gui stuff.
	QWidget *m_teamAWidget;///<Gui stuff.
	QWidget *m_teamBWidget;///<Gui stuff.
	QVBoxLayout *m_teamALayout;///<Gui stuff.
	QVBoxLayout *m_teamBLayout;///<Gui stuff.
	
	QList<UnitSelectionWidget*> m_teamASelection;///<Gui stuff. The kinds of widgets used to determine and later construct one specific unit.
	QList<UnitSelectionWidget*> m_teamBSelection;///<Gui stuff. The kinds of widgets used to determine and later construct one specific unit.
	QPushButton *m_teamAMore;///<Gui stuff.
	QPushButton *m_teamBMore;///<Gui stuff.
};

#endif
